﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using BALayer;

namespace QuanLyDoan
{
    public partial class FrmMain : Form
    {
        DBDoanVien dbBCH = null;
        DataTable dtBCH;

        string tendn;
        int i = 0;

        public FrmMain(string dn)
        {
            InitializeComponent();
            dbBCH = new DBDoanVien();
            tendn = dn;
        }

        void LoadData()
        {
            dtBCH = new DataTable();
            dtBCH.Clear();
            dtBCH = dbBCH.LayBCH(tendn).Tables[0];

            DataRow dr = dtBCH.Rows[0];//dt là DataTable
            lblDangNhap.Text = dr["Ten"].ToString();
        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }

        private void soDoanToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void FrmMain_Load(object sender, EventArgs e)
        {
            LoadData();
        }

        private void doanVienToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmTraCuuThongTinDV frm = new FrmTraCuuThongTinDV();
            frm.ShowDialog();
        }

        private void hoatDongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmTraCuuChuongTrinhHD frm = new FrmTraCuuChuongTrinhHD();
            frm.ShowDialog();

        }

        private void canBoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmTraCuuThongTinCanBo frm = new FrmTraCuuThongTinCanBo();
            frm.ShowDialog();
        }

        private void doanVienToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FrmThongKeDoanVien frm = new FrmThongKeDoanVien();
            frm.ShowDialog();
        }

        private void hoatDongToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            FrmThongKeHoatĐong frm = new FrmThongKeHoatĐong();
            frm.ShowDialog();
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            DialogResult trove;
            trove = MessageBox.Show("Bạn có chắc chắn muốn đóng ứng dụng không ?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
            if (trove == DialogResult.OK)
                this.Close();
        }

        private void donViToChucToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmQuanLyDVTC frm = new FrmQuanLyDVTC();
            frm.ShowDialog();
        }

        private void tTHoatDongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmQuanLyThongTinHoatDong frm = new FrmQuanLyThongTinHoatDong();
            frm.ShowDialog();
        }

        private void cTHoatDongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmQuanLyChuongTrinhHoatDong frm = new FrmQuanLyChuongTrinhHoatDong();
            frm.ShowDialog();
        }

        private void danhGiaHoatDongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmDanhGiaHoatDong frm = new FrmDanhGiaHoatDong();
            frm.ShowDialog();
        }

        private void thongTinHoatDongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmTraCuuHoatDong frm = new FrmTraCuuHoatDong();
            frm.ShowDialog();
        }

        private void traCuuToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void lienHeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmLienHe frm = new FrmLienHe();
            frm.ShowDialog();
        }

        private void troGiupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult traloi;
            traloi = MessageBox.Show("Phần mềm quản lý hoạt động Đoàn Khoa Công Nghệ Thông Tin\n Nguyễn Thế Bảo - 11110007\n Nguyễn Ngọc Thùy Duyên - 11110023\n Lê Tấn Thắng - 11110127\n Trần Đình Vũ - 11110164\n", "Trả lời",
            MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
        }

        private void doiMatKhauToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FrmDoiMatKhau frm = new FrmDoiMatKhau(tendn);
            frm.ShowDialog();
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            i++;
            if (i == 5) i = 1;
            pictureBox2.Image = Image.FromFile("Hinh\\" + i.ToString() + ".jpg");
        }
    }
}
